package IC;
import java.io.*;
import IC.Parser.*;

public class Compiler
{
    public static void main(String[] args)
    {
        Token currToken;
        try {
            FileReader txtFile = new FileReader(args[0]);
            Lexer lexer = new Lexer(txtFile);
            // run on each token
            do {
                currToken = lexer.next_token();
                System.out.println(currToken.toString());
            } while (currToken.sym != sym.EOF);
        } 
        // report about errors
        catch (LexicalError e) {
            System.out.println(e.toString());
        }
        catch (Exception e) {
        	System.out.println("IO Error (brutal exit)" + e.toString());
        }
    }
}
